import type * as T from './type'
import http from '@/utils/http'
import type {
  checkExamCertificateDto,
  MchExamRank,
  MchStudyRank,
  MchUserStudyStatistic,
  StatisticsData,
  TimePeriodAnalysisData
} from "./type";

const BASE_URL = '/business'
/** @desc 獲取首頁統計數據 */
export function getStatistics() {
  return http.get<StatisticsData>(`${BASE_URL}/customer/getHomeStatics`)
}

export function getPeriodAnalysis(query: { timePeriod: number }) {
  return http.get<TimePeriodAnalysisData>(`${BASE_URL}/customer/periodAnalysis`, query)
}
/** @desc 學習統計排行 */
export function getStudyRank() {
  return http.get<MchStudyRank>(`${BASE_URL}/studyRecord/getStudyRank`)
}

/** @desc 單元考試統計 */
export function getUnitExamStatist(query: { unitId: string }) {
  return http.get<MchExamRank>(`${BASE_URL}/studyRecord/getUnitExamStatist`, query)
}



/** @desc 認證考試統計 */
export function getAuthExamStatist() {
  return http.get<MchExamRank>(`${BASE_URL}/studyRecord/getAuthExamStatist`)
}


/** @desc 認證考試統計 */
export function getCustomerExamStatist(query:{ customerId: any }) {
  return http.get<MchUserStudyStatistic>(`${BASE_URL}/studyRecord/getCustomerExamStatist`,query)
}


/** @desc 本週導出 */
export function getWeekStudyRankExport() {
  return http.download(`${BASE_URL}/studyRecord/getWeekStudyRankExport`)
}



/** @desc 累計導出 */
export function getTotalStudyRankExport() {
  return http.download(`${BASE_URL}/studyRecord/getTotalStudyRankExport`)
}



/** @desc 認證考試導出 */
export function getAuthExamStatistExport() {
  return http.download(`${BASE_URL}/studyRecord/getAuthExamStatistExport`)
}


/** @desc 單元考試導出 */
export function getUnitExamStatistExport() {
  return http.download(`${BASE_URL}/studyRecord/getUnitExamStatistExport`)
}


/** @desc 根据考试编号查询证书 */
export function getExamCertificate(query: { examRecordId: any }) {
  return http.get<checkExamCertificateDto>(`${BASE_URL}/examRecord/getExamCertificate`,query)
}



